<?php
class Pergunta extends Zend_Db_Table
{
    protected $_name = 'pergunta';
    protected $_primary = 'per_codigo';
        
    public function load($id){
    	$db = Zend_Registry::get('db');
        $this->load($id);
        
    }

	public function delete($id){
		$where = $_primary . ' = ' .$id;
	    try {
                $this->delete($where);
        } catch (Exception $e) {
                if ($e->getCode()=='23000'){ // Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
                        $this->dat_exclusao   = date('Y-m-d H:m:s');
                        $this->uss_exclusao   = $usuario;
                        $dados = array('dat_exclusao'   =>$this->dat_exclusao,
                                       'uss_exclusao' 	=>$this->uss_exclusao);
                        $this->update($dados, $where);
                }
        }               
        }
        
        
}
